import request from '../../utils/request'



/**
 * 查询商品列表
 * @param hscode
 * @param status
 * @param page
 * @returns {Promise.<Object>}
 */
export async function getHscodeList({hscode, status, page}) {
    return request(apiPath.basedata + "/api/hscode", {
        method: 'get',
        data: {  hscode, status , page: page.page, size: page.size}
    });
}


/**
 *
 * @param hscode
 * @param status
 * @param page
 * @returns {Promise.<Object>}
 */
export async function getHscodeByCode({hscode}) {
    return request(apiPath.basedata + "/api/hscode/code/" + hscode, {
        method: 'get',
    });
}

/**
 * 查询商品详情
 * @param id
 * @returns {Promise.<Object>}
 */
export async function getHscodeById({id}) {
    return request(apiPath.basedata + "/api/hscode/" + id, {
        method: 'get'
    });
}


/**
 * 增加商品
 * @param hscode
 * @param taxcode
 * @param name
 * @param unit1
 * @param unit2
 * @param zzrate
 * @param taxrate
 * @param userId
 * @returns {Promise.<Object>}
 */
export async function addHscode({hscode, taxcode, name, unit1, unit2, zzrate, xfrate, taxrate, supercondition, declarelements, memo, userId}) {
    userId = 1;
    let creator = userId;
    return request(apiPath.basedata + "/api/hscode", {
        method: 'post',
        data: { hscode, taxcode, name, unit1, unit2, zzrate, xfrate, taxrate, supercondition, declarelements, memo, userId, creator}
    });
}

/**
 * 编辑商品
 * @param hscode
 * @param taxcode
 * @param name
 * @param unit1
 * @param unit2
 * @param zzrate
 * @param taxrate
 * @param userId
 * @returns {Promise.<Object>}
 */
export async function updateHscode({id, hscode, taxcode, name, unit1, unit2, zzrate, xfrate, taxrate, supercondition, declarelements, memo, userId}) {
    userId = 1;
    let updater = userId;
    return request(apiPath.basedata + "/api/hscode", {
        method: 'put',
        data: {id, hscode, taxcode, name, unit1, unit2, zzrate, xfrate, taxrate, supercondition, declarelements, memo,userId, updater}
    });
}

/**
 * 删除商品
 * @param id
 * @returns {Promise.<Object>}
 */
export async function deleteHscodeById({id}) {
    return request(apiPath.basedata + "/api/hscode/" + id, {
        method: 'delete'
    });
}


